import { Notify, Dialog } from 'vant'

export const msgSuccess = (data:any) => {
    Notify({
        background:'#255FB6',
        color:'#fff',
        message:data,
    })
} 

export const msgError = (data:any) => {
    Notify({
        background:'#CE0C0C',
        color:'#fff',
        message:data,
    })
}

export const msgConfirm = (data:any) => {
    return new Promise((resolve, reject) => {
        Dialog.alert({
            message: data,
            //theme: 'round-button',
            confirmButtonColor:'#255FB6',
            confirmButtonText:'确认',
            showCancelButton:true,
            cancelButtonColor:'#000',
            cancelButtonText:'返回',
        }).then((res:any) => {
           if(res === 'confirm') {
            resolve(res)
           }
        }).catch(((res:any) => {
            reject(res)
        }))
    })
}